package com.huiqiao.lesson6.beanConstructor;

import com.huiqiao.lesson6.beanConfig.Component.UserDao;
import com.huiqiao.lesson6.beanConfig.Component.UserService;
import org.springframework.stereotype.Component;

@Component
public class BeanConStructorDefaultClass {

    UserDao userDao;

    UserService userService;


    public BeanConStructorDefaultClass() {
        System.out.println("有无参构造函数情况下，spring默认使用无参构造函数初始化bean");
    }


    public BeanConStructorDefaultClass(UserDao userDao) {
        System.out.println("只有一个有参构造函数的情况下，spring会自动调用，并自动注入参数 userDao ==> " + userDao);
        this.userDao = userDao;
    }

    public BeanConStructorDefaultClass(UserDao userDao, UserService userService) {
        System.out.println("只有一个有参构造函数的情况下，spring会自动调用，并自动注入参数 userDao ==> " + userDao + " , userService ==> " + userService);
        this.userDao = userDao;
        this.userService = userService;
    }
}
